环境说明: CentOS Linux release 7.3.1611 (Core) 64位 mysql Ver 14.14 Distrib 5.7.19 现象: 安装完 Wordpress 及 DB 后,在 Wordpress 中删除了默认的文章,之后就突然莫名其妙的提示无法连接DB。(之前也可能做过了一些其它 DB 操作及修改,有点儿记不清了) 原因调查: 首先发现的是,不知道为什么,MySQL 被停止了,并且提示如下错误:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
# systemctl status mysqld.service ● mysqld.service - MySQL Server Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled) Active: failed (Result: start-limit) since 五 2017-10-20 09:13:16 CST; 633ms ago Docs: man:mysqld(8) http://dev.mysql.com/doc/refman/en/using-systemd.html Process: 10382 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=1/FAILURE) Process: 10365 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS) 10月 20 09:13:16 67-216-220-130 systemd[1]: Failed to start MySQL Server. 10月 20 09:13:16 67-216-220-130 systemd[1]: Unit mysqld.service entered failed state. 10月 20 09:13:16 67-216-220-130 systemd[1]: mysqld.service failed. 10月 20 09:13:16 67-216-220-130 systemd[1]: mysqld.service holdoff time over, scheduling restart. 10月 20 09:13:16 67-216-220-130 systemd[1]: start request repeated too quickly for mysqld.service 10月 20 09:13:16 67-216-220-130 systemd[1]: Failed to start MySQL Server. 10月 20 09:13:16 67-216-220-130 systemd[1]: Unit mysqld.service entered failed state. 10月 20 09:13:16 67-216-220-130 systemd[1]: mysqld.service failed.
之后查看 MySQL 日志:
1 2 3 4 5 6 7 8 9 10
# tail -n 100 /var/log/mysqld.log ...... 2017-10-20T01:09:48.647161Z 0 [Note] InnoDB: Buffer pool(s) load completed at 171020 9:09:48 2017-10-20T01:09:48.647236Z 0 [Note] InnoDB: Starting shutdown... 2017-10-20T01:09:48.747574Z 0 [Note] InnoDB: Dumping buffer pool(s) to /var/lib/mysql/ib_buffer_pool 2017-10-20T01:09:48.747891Z 0 [ERROR] InnoDB: Cannot open '/var/lib/mysql/ib_buffer_pool.incomplete'for writing: Permission denied 2017-10-20T01:09:50.258312Z 0 [Note] InnoDB: Shutdown completed; log sequence number 4076122 2017-10-20T01:09:50.258371Z 0 [ERROR] InnoDB: Operating system error number 13 in a file operation. 2017-10-20T01:09:50.258378Z 0 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory. ......